@echo off

echo Setting Java Environment to the following: 
call setenv.bat
java -version
echo Completed setting Java Environment.

echo.
echo Cleaning up folders...
rmdir /s /q classes
rmdir /s /q javadocs

echo.
echo Creating directory and compiling source...
mkdir classes 
javac -sourcepath src -d classes src\sg\edu\nus\iss\jass\JASSApplication.java
javac -sourcepath src -d classes src\sg\edu\nus\iss\jass\dao\MockPropertiesDAO.java
javac -sourcepath src -d classes src\sg\edu\nus\iss\jass\model\MockPropertiesDTO.java
echo Completed compiling all source.
echo.

echo.
echo Start compiling JUnit source...
javac -sourcepath test -d classes test\sg\edu\nus\iss\jass\controller\*.java
javac -sourcepath test -d classes test\sg\edu\nus\iss\jass\dao\*.java
javac -sourcepath test -d classes test\sg\edu\nus\iss\jass\*.java
echo Completed compiling all JUnit source.
echo.

echo.
echo Start running JUnit testing...
java org.junit.runner.JUnitCore sg.edu.nus.iss.jass.AllTests
echo Completed JUnit testing.
echo.

echo.
echo Start generating javadocs...
javadoc -d .\javadocs -sourcepath .\src -subpackages sg.edu.nus.iss.jass
echo Completed generating javadocs.
echo.

pause